# favorite_languages = {
#     'jen': 'python',
#     'sarah': 'c',
#     'edward': 'ruby',
#     'phil': 'python'
# }

# language = favorite_languages['sarah'].title()
# print(f"sarah‘s favorite language is {language}")
# print(favorite_languages.get('phil', 'no tom value assigned').title())
# for name,language in favorite_languages.items():
#     print(f"{name.title()}'s favorite language is {language.title()}")
# for name in favorite_languages.keys():
#     print(name.title())
# friends = ['phil', 'sarah']
# for name in favorite_languages.keys():
#     print(f"Hi,{name.title()}")
#     if name in friends:
#         print(f"\t{name},I see you love {favorite_languages[name].title()}")
# for name in sorted(favorite_languages.keys()):
#     print(f"{name.title()},thank you for taking poll")

#遍历字典中的所有值
# for language in set(favorite_languages.values()):
#     print(language.title())

# people = ['phil','tom','jack','jen']
#
# for name in people:
#     if name in favorite_languages.keys():
#         print(f"Hi,{name},Thank you for your taking")
#     else:
#         print(f"{name},please  do your poll")

#列表字典
favorite_languages = {
    'jen': ['python', 'ruby'],
    'sarah': ['c'],
    'edward': ['ruby', 'go'],
    'phil': ['python', 'haskell']
}

for name,langs in favorite_languages.items():
    print(f"\n{name.title()}'s favorite languages:")
    for lang in langs:
        print(f"\t{lang.title()}")